/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package outils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

/**
 *
 * @author Aude Legrand, Alexandre Becquet
 */
public class OutilsDate {
    
    public static Date stringToDate(String sDate, String sFormat) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat(sFormat);
        return sdf.parse(sDate);
    } 
    
    public static int yearOfDate(Date d){
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(d);
        return calendar.get(Calendar.YEAR);
    }

}
